#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"convert.h"

int main(int argc,char** argv)
{
	char* buffer=NULL;
	char* answer=NULL;
	if(argc>=3||argc==1)
	{
		printf("usage: %s [source string]\n",argv[0]);
		return 0;
	}
	if(argc==2)
		buffer=argv[1];
	if(buffer==NULL)
	{
		buffer=malloc(sizeof(char)*1024);
		memset(buffer,0,sizeof(buffer));
		scanf("%s",buffer);
	}
	answer=malloc(strlen(buffer)*sizeof(char));
	if(convert_thunder_to_url(buffer,answer,strlen(buffer)))
		printf("the destination url is : %s\n",answer);
	else
		printf("error:the string is not a thunder resource\n");
	return 0;
}
